//
//  WelcomeViewController.swift
//  weibo1
//
//  Created by changhongliang on 2017/7/26.
//  Copyright © 2017年 richinfo. All rights reserved.
//

import UIKit
import SDWebImage

class WelcomeViewController: UIViewController {
    
    @IBOutlet weak var iconBottomCons: NSLayoutConstraint!
    @IBOutlet weak var headerIcon: UIImageView!

    @IBOutlet weak var titleLable: UILabel!
    override func viewDidLoad() {
        super.viewDidLoad()
        //设置用户头像
        if UserAccount.loadUserAccount() != nil {
            let urlString = UserAccount.loadUserAccount()?.avatar_large
            headerIcon.layer.cornerRadius = headerIcon.frame.size.width * 0.5
            headerIcon.clipsToBounds = true
            headerIcon.sd_setImage(with: NSURL(string: urlString!)!as URL)
        }

    }
    
    override func viewDidAppear(_ animated: Bool) {
        let offset = view.bounds.height - iconBottomCons.constant
        iconBottomCons.constant = offset
        UIView.animate(withDuration: 1.0, animations: { 
            self.view.layoutSubviews()
        }) { (_) in
            UIView.animate(withDuration: 1.0, animations: { 
               self.titleLable.alpha = 1.0
            }, completion: { (_) in
                NotificationCenter.default.post(name:NSNotification.Name(rawValue: HLSwitchMainInterfaceNotification), object: true)
            })
        }
    }

   
}
